package org.ecshop.controllers;

import java.util.List;

import javax.annotation.Resource;

import org.ecshop.models.GoodsName;

import will.icecoffe.core.DataAccessException;
import will.icecoffe.core.SimpleDataAccessService;

import com.opensymphony.xwork2.ModelDriven;



public class GoodsNameController implements ModelDriven<Object> {
	
	private int id;
	private GoodsName goods;
	private List<GoodsName> list;
	
	private String key;
	
	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}


	@Resource(name="DAS")
	private SimpleDataAccessService<GoodsName> das;
	
	public String index() throws DataAccessException {
		System.out.println(key);
		this.list = das.find("hql", 1, 10, "goodsSearchTips", "%" + key + "%");
		return null;
		
	}
	
	public String edit() {
		
		return null;
		
	}
	
	public String editNew() {
		
		return null;
		
	}
	
	public String create() {
		
		return null;
		
	}
	
	
	@Override
	public Object getModel() {
		return (list != null ? list : goods);
	}

}
